import Router from "vue-router";
import Vue from "vue";

Vue.use(Router);

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

const router = new Router({
  mode: "history",
  routes: [
    {
      path: "/",
      name: "Index",
      component: () => import("@/views/index/Index.vue"),
    },
    {
      path: "/topic/:id",
      name: "details",
      component: () => import("@/views/details/Index.vue"),
    },
    {
      path: "/login",
      name: "login",
      component: () => import("@/views/login/Index.vue"),
    },
  ],
});

export default router;
